/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package control.benhan;

import com.toedter.calendar.JDateChooser;
import java.util.Date;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import model.dao.addxuonghibernate.PhieuDieuTriDAO;

/**
 *
 * @author Admin
 */
public class PDTThem_Dialog_Ctrl {
    
    public static final void themPhieuDieuTri(JTable table, JTextField tfMaHoSo, JDateChooser jdateNgayBD, JDateChooser jdateNgayTaiKham){
        int maHoSo = Integer.parseInt(tfMaHoSo.getText());
        Date ngayBD = jdateNgayBD.getDate();
        Date ngayKT = jdateNgayTaiKham.getDate();
//        String tenBenh = tfTenBenh.getText();
        
        boolean pdt = PhieuDieuTriDAO.themPhieuDieuTri(maHoSo, ngayKT, ngayKT);
        if(pdt == false){
            JOptionPane.showMessageDialog(null, "Không thêm được");
        }else{
            BAMainPanel_Ctrl.loadAllPhieuDiauTriTheoMa(table, maHoSo);
        }
    }
}
